<?php
namespace MyAdmin\Controller;

use Think\Controller;

class MsgsController extends CommonController
{
  public function __construct()
  {
    parent::__construct();
    $this->check_login();
  }

  public function show()
  {
    $id = I("id", 0);
    $msg = M('messages')->where("id=$id")->field('status, types')->find();
    if ($msg['status'] == 0) {
      M('messages')->where("id=$id")->save(array('status' => 1));
    }
    switch ($msg['types']) {
      case 1:
        $url = U('Orders/index?status=10');
        break;
      case 2:
        $url = U("Settlements/amount_logs?status=2");
        break;
      case 3:
        $url = U("Orders/index?status=9");
        break;
      case 4:
        $url = U("Orders/index?status=2");
        break;
      case 5:
        $url = U("Orders/index?status=6");
        break;
      case 6:
        $url = U("Settlements/amount_logs?status=2&types=2");
        break;
    }
    $this->redirect($url,0);
  }
}
